package project_phase3;

public class ContactHeight {

	private int feet;
	private int inches;
	
	public ContactHeight(int feet, int inches) throws IllegalArgumentException {
		if(feet < 0 || feet > 12)
			throw new IllegalArgumentException("Feet must be between 0 and 12");
		if(inches < 0 || inches > 11)
			throw new IllegalArgumentException("Inches must be between 0 and 11");
		this.feet = feet;
		this.inches = inches;
	}
	
	public int getFeet() {
		return feet;
	}
	
	public int getInches() {
		return inches;
	}

	public boolean isTallerThan(ContactHeight h2) {
		//is this height object taller than arg h2
		if(this.feet > h2.getFeet())
			return true;
		if(this.feet < h2.getFeet())
			return false;
		if(this.inches > h2.getInches())
			return true;
		return false;
	}

	public boolean isTallerOrEqualThan(ContactHeight h2) {
		//is this height object taller than or same height as arg h2
		if(this.feet > h2.getFeet())
			return true;
		if(this.feet < h2.getFeet())
			return false;
		if(this.inches >= h2.getInches())
			return true;
		return false;
	}

	public boolean isShorterThan(ContactHeight h2) {
		//is this height object shorter than arg h2
		return !isTallerOrEqualThan(h2);
	}

	public boolean isShorterOrEqualThan(ContactHeight h2) {
		//is this height object shorter or than or same height as arg h2
		return !isTallerThan(h2);
	}

	public String toString() {
		return Integer.toString(feet) + "'" + Integer.toString(inches) + "\"";
	}
	
}
